<!--page description, messages-->
<% if @work.unrevealed? %>
  <p class="message">
    <%= ts("This work is part of an ongoing challenge and will be revealed soon! You can find details here: ") %>
    <%= @work.collections.unrevealed.collect {|challenge| link_to(challenge.title, collection_path(challenge))}.join(", ").html_safe %>
  </p>
<% end %>
<!--/descriptions-->

<!--subnav-->
<% if logged_in_as_admin? %>
<%= render :partial => 'admin/admin_options', :locals => {:item => @work} %>
<% end %>
<!--/subnav-->

<% if !@work.unrevealed? || logged_in_as_admin? || is_author_of?(@work) || (@work.unrevealed? && can_see_work(@work, current_user)) %>
<!-- BEGIN work -->
<div class="work"><p class="landmark"><a name="top">&nbsp;</a></p>
  <%= render :partial => 'works/work_header' %>

  <div id="chapters">
    <%= render :partial => 'chapters/chapter', :locals => { :chapter => @chapter } %>
    <% if !@work.endnotes.blank? && @chapter == @work.last_chapter %>
      <div id="work_endnotes" class="chapter preface footnotes module" role="complementary">
          <h3><%=h "Notes:" %></h3>
          <blockquote class="userstuff"><%=raw sanitize_field(@work, :endnotes) %></blockquote>
      </div>
    <% end %>
  </div>
<!-- END work skin -->
    <!-- Series links -->
    <% unless @preview_mode || @work.series.blank? || @chapter != @work.last_chapter%>
      <%= render :partial => 'works/series_links' %>
    <% end %>
  </div>

  <%= render :partial => 'works/work_footer' %>

</div>
<!-- END work -->

<!-- BEGIN comment section -->
<%= render :partial => 'comments/commentable', :locals => {:commentable => @chapter} %>
<!-- END comment section -->
<% end %>
